import wx
import wx.lib.agw.buttonpanel as bp
import  wx.lib.layoutf  as layoutf
from wx import aui

class Example(wx.Frame):
    
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, None, -1, 'Elisoft CRT', size=(900, 700), style = wx.RESIZE_BORDER) 
        
        self.SetMinSize((650, 500))  
        self.SetBackgroundColour("#18618A")  
        self.InitUI()
        
    
    def OnMaximine(self,event):
#        self.Move((0,0))
#        self.SetSize(wx.GetDisplaySize())
        if self.IsMaximized():
            bmp = wx.Bitmap("image/max.bmp", wx.BITMAP_TYPE_BMP)
            bmp2 = wx.Bitmap("image/max2.bmp", wx.BITMAP_TYPE_BMP)
        else:
            bmp = wx.Bitmap("image/maxi.bmp", wx.BITMAP_TYPE_BMP)
            bmp2 = wx.Bitmap("image/maxi2.bmp", wx.BITMAP_TYPE_BMP)
        
        self.btresize_max.SetBitmapLabel(bmp)
        self.btresize_max.SetBitmapHover(bmp2)
        self.Maximize(not self.IsMaximized())
#        self.ShowFullScreen(not self.IsMaximized(),style=wx.FULLSCREEN_ALL)

    def OnMinimine(self,event):
        self.Iconize(True)
    
    def OnCloseBT(self,event):
        self.Destroy()
        
    def InitUI(self): 
        self.bm_connect = wx.Bitmap("image/connect.png", wx.BITMAP_TYPE_ANY)
        self.bm_new = wx.Bitmap("image/new.png", wx.BITMAP_TYPE_ANY)
        self.bm_disconnect = wx.Bitmap("image/disconnect.png", wx.BITMAP_TYPE_ANY)
        self.bm_copy = wx.Bitmap("image/copy.png", wx.BITMAP_TYPE_ANY)
        self.bm_paste = wx.Bitmap("image/paste.png", wx.BITMAP_TYPE_ANY)
        self.bm_find = wx.Bitmap("image/find.png", wx.BITMAP_TYPE_ANY)
        self.bm_print = wx.Bitmap("image/print.png", wx.BITMAP_TYPE_ANY)
        self.bm_color = wx.Bitmap("image/colorchange.png", wx.BITMAP_TYPE_ANY)
        self.bm_font = wx.Bitmap("image/font.png", wx.BITMAP_TYPE_ANY)
        self.bm_newssh = wx.Bitmap("image/new.png", wx.BITMAP_TYPE_ANY)
        self.bm_sendfile = wx.Bitmap("image/OnSend.bmp", wx.BITMAP_TYPE_ANY)
        self.bm_screen = wx.Bitmap("image/fullcreen.png", wx.BITMAP_TYPE_ANY)  
        self.bm_lock = wx.Bitmap("image/lock.png", wx.BITMAP_TYPE_ANY)  
        self.bm_keyboard = wx.Bitmap("image/kb.png", wx.BITMAP_TYPE_ANY)  
        self.bm_option = wx.Bitmap("image/seting.png", wx.BITMAP_TYPE_ANY)  
        self.plus = wx.Bitmap("image/plus.png", wx.BITMAP_TYPE_ANY)
        self.bm_bg_top = wx.Bitmap("image/bg_top.bmp", wx.BITMAP_TYPE_ANY)

        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.AllowMoveFrame = False
        self.m_delta = (0,0)
#        ----MAIN PANEL-------
        self.mainPanel = wx.Panel(self, -1)
        self.mainPanel.SetBackgroundColour("#18618A")
        self.mainPanel.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackgroundTop)
        self.mainPanel.SetAutoLayout(True)
#<<<<<<< .mine
#        self.mainPanel.SetBackgroundColour(wx.Colour(20,95,137))
#=======

        self.mainPanel.SetBackgroundColour("#18618A")

        self.mainPanel.Bind(wx.EVT_MOTION, self.OnMouseMove)
        self.mainPanel.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.mainPanel.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)

        
        image = wx.Image("image/ssh.ico",wx.BITMAP_TYPE_ANY)
        image = image.Scale(22,22)
        icon = wx.StaticBitmap(self.mainPanel, -1)
        icon.SetConstraints(layoutf.Layoutf('t=t5#1;l=l6#1;h*;w*', (self.mainPanel,)))
        icon.SetBitmap(wx.BitmapFromImage(image))
        
        bmp = wx.Bitmap("image/lg_name.bmp", wx.BITMAP_TYPE_BMP)
        b = wx.BitmapButton(self.mainPanel, -1, bmp,(bmp.GetWidth(), bmp.GetHeight()),style = wx.NO_BORDER)
        b.SetConstraints(layoutf.Layoutf('t=t5#1;l>#2;h*;w*', (self.mainPanel,icon)))
        
        bmp = wx.Bitmap("image/min.bmp", wx.BITMAP_TYPE_BMP)
        bmp2 = wx.Bitmap("image/min2.bmp", wx.BITMAP_TYPE_BMP)
        self.btresize_min = wx.BitmapButton(self.mainPanel, -1, bmp,(bmp.GetWidth(), bmp.GetHeight()),style = wx.NO_BORDER)
        self.btresize_min.SetBitmapHover(bmp2)
        self.btresize_min.SetConstraints(layoutf.Layoutf('t=t#1;r=r66#1;h*;w*', (self.mainPanel,)))
        
        bmp = wx.Bitmap("image/max.bmp", wx.BITMAP_TYPE_BMP)
        bmp2 = wx.Bitmap("image/max2.bmp", wx.BITMAP_TYPE_BMP)
        self.btresize_max = wx.BitmapButton(self.mainPanel, -1, bmp,(bmp.GetWidth(), bmp.GetHeight()),style = wx.NO_BORDER)
        self.btresize_max.SetBitmapHover(bmp2)
        self.btresize_max.SetConstraints(layoutf.Layoutf('t=t#1;r=r33#1;h*;w*', (self.mainPanel,)))
        
        bmp = wx.Bitmap("image/daux.bmp", wx.BITMAP_TYPE_BMP)
        bmp2 = wx.Bitmap("image/daux2.bmp", wx.BITMAP_TYPE_BMP)
        self.btclose_x = wx.BitmapButton(self.mainPanel, -1, bmp,(bmp.GetWidth(), bmp.GetHeight()),style = wx.NO_BORDER)
        self.btclose_x.SetBitmapHover(bmp2)
        self.btclose_x.SetConstraints(layoutf.Layoutf('t=t#1;r=r6#1;h*;w*', (self.mainPanel,)))
        
        self.Bind(wx.EVT_BUTTON, self.OnCloseBT, self.btclose_x)
        self.Bind(wx.EVT_BUTTON, self.OnMaximine, self.btresize_max)
        self.Bind(wx.EVT_BUTTON, self.OnMinimine, self.btresize_min)
#        b1 = wx.Button(self.mainPanel, -1, ' Panel B1 ')
#        b1.SetConstraints(layoutf.Layoutf('t=t1#1;r=r6#1;h*;w*', (self.mainPanel,)))
        
#        b2 = wx.Button(self.mainPanel, -1, ' Panel B2 ')
#        b2.SetConstraints(layoutf.Layoutf('t=t1#1;r<0#2;h*;w*', (self.mainPanel,b1,)))
#        
#        b3 = wx.Button(self.mainPanel, -1, ' Panel B3 ')
#        b3.SetConstraints(layoutf.Layoutf('t=t1#1;r<0#2;h*;w*', (self.mainPanel,b2,)))

#        ----menu----
        self.panel = wx.Window(self.mainPanel, -1,style = wx.NO_BORDER)
        self.panel.SetBackgroundColour("#E5E5E5")
        self.panel.SetConstraints(
            layoutf.Layoutf('t=t35#1;l=l5#1;b=b5#1;r=r5#1',(self.mainPanel,))
            )
#        ---------LEFT-BOTTOM-RIGHT-------
        panelLeft = wx.Panel(self.mainPanel,-1)
        panelLeft.SetBackgroundColour("#18618A")
        panelLeft.SetConstraints(
            layoutf.Layoutf('t=t32#1;l=l0#1;b=b5#1;r<#2',(self.mainPanel,self.panel))
            )
        
        panelLeft = wx.Panel(self.mainPanel,-1)
        panelLeft.SetBackgroundColour("#18618A")
        panelLeft.SetConstraints(
            layoutf.Layoutf('t=t32#1;r=r0#1;b=b5#1;l>#2',(self.mainPanel,self.panel))
            )
        
        panelLeft = wx.Panel(self.mainPanel,-1)
        panelLeft.SetBackgroundColour("#18618A")
        panelLeft.SetConstraints(
            layoutf.Layoutf('b=b0#1;l=l0#1;h!5;w%w100#1',(self.mainPanel,self.panel,))
            )
#        ---------LEFT-BOTTOM-RIGHT-------
        self.menuPanel = wx.Panel(self.panel, -1,pos=(5,30),size=(875, 95))
        self.menuPanel.SetConstraints(
            layoutf.Layoutf('X=X#1;Y!21;h!43;w%w100#1',(self.panel,))
            )
        
        self.menuPanel.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        
        
        bmp = wx.Bitmap("image/ssh_03.png", wx.BITMAP_TYPE_ANY)
        w = bmp.GetWidth()
        self.menuHome = wx.BitmapButton(self.menuPanel, -1, bmp, pos = (5,5),size=(bmp.GetWidth(), bmp.GetHeight()),name="ssh_3")
        self.menuHome.SetBitmapDisabled(wx.Bitmap("image/ssh_13.png", wx.BITMAP_TYPE_ANY))
        self.menuHome.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
        self.menuHome.Bind(wx.EVT_BUTTON, self.MenuHome)
        self.menuHome.Enable(False)
        
        bmp = wx.Bitmap("image/ssh_04.png", wx.BITMAP_TYPE_ANY)
        self.menuEdit = wx.BitmapButton(self.menuPanel, -1, bmp, pos = (5+w,5),size=(bmp.GetWidth(), bmp.GetHeight()),name="ssh_4")
        self.menuEdit.SetBitmapDisabled(wx.Bitmap("image/ssh_14.png", wx.BITMAP_TYPE_ANY))
        self.menuEdit.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
        self.menuEdit.Bind(wx.EVT_BUTTON, self.MenuHome)
        w = bmp.GetWidth()
        
        bmp = wx.Bitmap("image/ssh_05.png", wx.BITMAP_TYPE_ANY)
        x,y = self.menuEdit.GetPosition()
        self.menuView = wx.BitmapButton(self.menuPanel, -1, bmp, pos = (5+x+w,5),size=(bmp.GetWidth(), bmp.GetHeight()),name="ssh_5")
        self.menuView.SetBitmapDisabled(wx.Bitmap("image/ssh_15.png", wx.BITMAP_TYPE_ANY))
        self.menuView.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
        self.menuView.Bind(wx.EVT_BUTTON, self.MenuHome)
        w = bmp.GetWidth()
        
        bmp = wx.Bitmap("image/ssh_06.png", wx.BITMAP_TYPE_ANY)
        x,y = self.menuView.GetPosition()
        self.menuUpdate = wx.BitmapButton(self.menuPanel, -1, bmp, pos = (5+x+w,5),size=(bmp.GetWidth(), bmp.GetHeight()),name="ssh_6")
        self.menuUpdate.SetBitmapDisabled(wx.Bitmap("image/ssh_16.png", wx.BITMAP_TYPE_ANY))
        self.menuUpdate.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
        self.menuUpdate.Bind(wx.EVT_BUTTON, self.MenuHome)
        #---------------toolbar-------------

        self.toolbar1 = bp.ButtonPanel(self.panel, -1, "",
                                          agwStyle=bp.BP_USE_GRADIENT, alignment=bp.BP_ALIGN_LEFT)
        self.toolbar1.SetConstraints(
            layoutf.Layoutf('X=X#1;Y!64;h!60;w%w100#1',(self.panel,))
            )

        bpArt = self.toolbar1.GetBPArt()
        bpArt.SetColour(bp.BP_BORDER_COLOUR, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_FROM, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_TO, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_BUTTONTEXT_COLOUR, wx.Colour(0, 0, 0))
        bpArt.SetColour(bp.BP_SEPARATOR_COLOUR,
                        bp.BrightenColour(wx.Colour(60, 11, 112), 0.85))
        bpArt.SetColour(bp.BP_SELECTION_BRUSH_COLOUR, wx.Colour(255, 255, 255))
        bpArt.SetColour(bp.BP_SELECTION_PEN_COLOUR, wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
       
        self.btnconnect = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_connect, text='  Connect  ',
                            shortHelp='Connect')
        self.toolbar1.AddButton(self.btnconnect)
        
        self.btnbm_new = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_new, text='  New  ',
                            shortHelp='New')
        self.toolbar1.AddButton(self.btnbm_new)
        
        self.btndisconnect = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_disconnect, text='  Disconnect  ',
                            shortHelp='Disconnect')
        self.toolbar1.AddButton(self.btndisconnect)
        self.toolbar1.AddSeparator()
        
        self.btncopy = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_copy, text='  Copy  ',
                            shortHelp='Copy')
        self.toolbar1.AddButton(self.btncopy)
        
        self.btnpaste = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_paste, text='  Paste  ',
                            shortHelp='Paste')
        self.toolbar1.AddButton(self.btnpaste)
        
        self.btnfind = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_find, text='  Find  ',
                            shortHelp='Find')
        self.toolbar1.AddButton(self.btnfind)
        self.toolbar1.AddSeparator()
        
        self.btnprint = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_print, text='  Print  ',
                            shortHelp='Print')
        self.toolbar1.AddButton(self.btnprint)
        
        self.btncolor = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_color, text='  Color  ',
                            shortHelp='Color')
        self.toolbar1.AddButton(self.btncolor)
        
        self.btnfont = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_font, text='  Font  ',
                            shortHelp='Font')
        self.toolbar1.AddButton(self.btnfont)
        self.toolbar1.AddSeparator()
        
        self.btnnewssh = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_newssh, text='  New window  ',
                            shortHelp='New window')
        self.toolbar1.AddButton(self.btnnewssh)
        
        self.btnsendfile = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_sendfile, text='  Send  ',
                            shortHelp='Send')
        self.toolbar1.AddButton(self.btnsendfile)
        
        self.btnscreen = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_screen, text='  Screen  ',
                            shortHelp='Screen')
        self.toolbar1.AddButton(self.btnscreen)
        
        self.btnlock = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_lock, text='  Lock  ',
                            shortHelp='Lock')
        self.toolbar1.AddButton(self.btnlock)
        self.toolbar1.AddSeparator()
        
        self.btnkeyboard = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_keyboard, text='  Keyboard  ',
                            shortHelp='Keyboard')
        self.toolbar1.AddButton(self.btnkeyboard)
        
        self.btnoption = bp.ButtonInfo(self.toolbar1, wx.NewId(),
                            self.bm_option, text='  Option  ',
                            shortHelp='Option')
        self.toolbar1.AddButton(self.btnoption)

        self.toolbar1.DoLayout()
        #---------------toolbar-------------
        self.toolbar2 = bp.ButtonPanel(self.panel, -1, "",
                                          agwStyle=bp.BP_USE_GRADIENT, alignment=bp.BP_ALIGN_LEFT)
        self.toolbar2.SetConstraints(
            layoutf.Layoutf('X=X#1;Y!64;h!60;w%w100#1',(self.panel,))
            )

        bpArt = self.toolbar2.GetBPArt()
        bpArt.SetColour(bp.BP_BORDER_COLOUR, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_FROM, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_TO, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_BUTTONTEXT_COLOUR, wx.Colour(0, 0, 0))
        bpArt.SetColour(bp.BP_SEPARATOR_COLOUR,
                        bp.BrightenColour(wx.Colour(60, 11, 112), 0.85))
        bpArt.SetColour(bp.BP_SELECTION_BRUSH_COLOUR, wx.Colour(255, 255, 255))
        bpArt.SetColour(bp.BP_SELECTION_PEN_COLOUR, wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
       
        self.btnconnect = bp.ButtonInfo(self.toolbar2, wx.NewId(),
                            self.bm_connect, text='  Connect  ',
                            shortHelp='Connect')
        self.toolbar2.AddButton(self.btnconnect)
        self.toolbar2.DoLayout()
         #---------------toolbar-------------
        self.toolbar3 = bp.ButtonPanel(self.panel, -1, "",
                                          agwStyle=bp.BP_USE_GRADIENT, alignment=bp.BP_ALIGN_LEFT)
        self.toolbar3.SetConstraints(
            layoutf.Layoutf('X=X#1;Y!64;h!60;w%w100#1',(self.panel,))
            )

        bpArt = self.toolbar3.GetBPArt()
        bpArt.SetColour(bp.BP_BORDER_COLOUR, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_FROM, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_TO, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_BUTTONTEXT_COLOUR, wx.Colour(0, 0, 0))
        bpArt.SetColour(bp.BP_SEPARATOR_COLOUR,
                        bp.BrightenColour(wx.Colour(60, 11, 112), 0.85))
        bpArt.SetColour(bp.BP_SELECTION_BRUSH_COLOUR, wx.Colour(255, 255, 255))
        bpArt.SetColour(bp.BP_SELECTION_PEN_COLOUR, wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
       
        self.btnconnect = bp.ButtonInfo(self.toolbar3, wx.NewId(),
                            self.bm_connect, text='  Connect  ',
                            shortHelp='Connect')
        self.toolbar3.AddButton(self.btnconnect)
        self.toolbar3.DoLayout()
         #---------------toolbar-------------
        self.toolbar4 = bp.ButtonPanel(self.panel, -1, "",
                                          agwStyle=bp.BP_USE_GRADIENT, alignment=bp.BP_ALIGN_LEFT)
        self.toolbar4.SetConstraints(
            layoutf.Layoutf('X=X#1;Y!64;h!60;w%w100#1',(self.panel,))
            )
        bpArt = self.toolbar4.GetBPArt()
        bpArt.SetColour(bp.BP_BORDER_COLOUR, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_FROM, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_GRADIENT_COLOUR_TO, wx.Colour(229, 229, 229))
        bpArt.SetColour(bp.BP_BUTTONTEXT_COLOUR, wx.Colour(0, 0, 0))
        bpArt.SetColour(bp.BP_SEPARATOR_COLOUR,
                        bp.BrightenColour(wx.Colour(60, 11, 112), 0.85))
        bpArt.SetColour(bp.BP_SELECTION_BRUSH_COLOUR, wx.Colour(255, 255, 255))
        bpArt.SetColour(bp.BP_SELECTION_PEN_COLOUR, wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
       
        self.btnconnect = bp.ButtonInfo(self.toolbar4, wx.NewId(),
                            self.bm_connect, text='  Connect  ',
                            shortHelp='Connect')
        self.toolbar4.AddButton(self.btnconnect)
        self.toolbar4.DoLayout()
        
        #--------tab----------
        self.nb = aui.AuiNotebook(self.panel,size=(800,600),style=wx.BORDER_NONE )
        
        self.nb.SetConstraints(
            layoutf.Layoutf('t=t94#1;l=l0#1;b=b0#1;r=r0#1',(self.panel,))
            )
        
        page = wx.TextCtrl(self.nb, -1, "sdfsd", style=wx.TE_MULTILINE)
        self.nb.AddPage(page, "Welcome")   
        self.SetTitle('Toolbars')
        self.Centre()
        self.Show(True)
        self.toolbar2.Show(False)
        self.toolbar3.Show(False)
        self.toolbar4.Show(False)
        
        self.SetSize((900,701))
    
    def OnMouseMove(self,event):
        pt = event.GetPosition();
        if event.Dragging() and event.LeftIsDown() and self.AllowMoveFrame:
            pos = self.mainPanel.ClientToScreen(pt)
            self.Move(wx.Point(pos.x - self.m_delta.x, pos.y - self.m_delta.y))

    def OnLeftUp(self,event):
        if self.mainPanel.HasCapture():
            self.mainPanel.ReleaseMouse()
            self.AllowMoveFrame = False
        
    
    def OnLeftDown(self,event):
        if event.GetPosition().y < 30:
            self.AllowMoveFrame = True
            self.mainPanel.CaptureMouse()
            pos = self.mainPanel.ClientToScreen(event.GetPosition())
            origin = self.GetPosition()
            dx =  pos.x - origin.x
            dy = pos.y - origin.y
            self.m_delta = wx.Point(dx, dy)
        
    def MenuHome(self, evt):
        currentMenu = evt.GetEventObject()
        self.EnableAllMenu()
        currentMenu.Enable(False)
        if currentMenu.GetName()=="ssh_3":
            self.HideAllToolbar()
            self.toolbar1.Show(True)
            
        elif currentMenu.GetName()=="ssh_4":
            self.HideAllToolbar()
            self.toolbar2.Show(True)
        
        elif currentMenu.GetName()=="ssh_5":
            self.HideAllToolbar()
            self.toolbar3.Show(True)
        
        else:
            self.HideAllToolbar()
            self.toolbar4.Show(True)
            
        self.vbox.RecalcSizes()
            
    
    def EnableAllMenu(self):
        self.menuHome.Enable(True)
        self.menuEdit.Enable(True)
        self.menuView.Enable(True)
        self.menuUpdate.Enable(True)
    
    def HideAllToolbar(self):
        self.toolbar1.Show(False)
        self.toolbar2.Show(False)
        self.toolbar3.Show(False)
        self.toolbar4.Show(False)
        
        
    def OnEraseBackground(self, evt):
        dc = evt.GetDC()
 
        if not dc:
            dc = wx.ClientDC(self)
            rect = self.GetUpdateRegion().GetBox()
            dc.SetClippingRect(rect)
        dc.Clear()
        bmp = wx.Bitmap("image/bg_menu.png")
        
        dc.DrawBitmap(bmp, 0, 0,True)
    
    def OnEraseBackgroundTop(self, evt):
        dc = evt.GetDC()
 
        if not dc:
            dc = wx.ClientDC(self)
            rect = self.GetUpdateRegion().GetBox()
            dc.SetClippingRect(rect)
        dc.Clear()
#        dc.SetBackground(wx.Brush("#18618A"))
        dc.DrawBitmap(self.bm_bg_top, 0, 0,True)
#        self.mainPanel.SetBackgroundColour("#18618A")
    
    

def main():
    
    ex = wx.App()
    Example(None)
    ex.MainLoop()    


if __name__ == '__main__':
    main()